import request from "@/utils/request";
import requestImg from "@/utils/requestImg";
const myApi = {
  // 查询用户信息
  selectUserById: async () => {
    return await request({
      url: "/app/user/selectUserById",
      method: "GET",
    });
  },
  // 漫友社区
  community: async () => {
    return await request({
      url: "/app/user/community",
      method: "GET",
    });
  },
  // 绑定邀请码
  bindInviterCode: async (code) => {
    return await request({
      url: `/app/invite/insertInvitationCode?code=${code}`,
      method: "GET",
    });
  },
  // 绑定手机号
  updatePhone: async (params) => {
    const { phone, msg } = params;
    return await request({
      url: `/app/user/updatePhone?phone=${phone}&msg=${msg}`,
      method: "POST",
    });
  },
  // 修改密码
  updatePassword: async (params) => {
    const { pwd, oldPwd } = params;
    return await request({
      url: `/app/user/updatePwd?pwd=${pwd}&oldPwd=${oldPwd}`,
      method: "POST",
    });
  },
  // 长轮询消息
  pollMessages: async (lastTime) => {
    return await request({
      url: `/app/message/userMessage/pollMessagesByTime=${lastTime}`,
      method: "GET",
    });
  },
  // 获取消息列表
  userMessage: async (params) => {
    return await request({
      url: `/app/message/userMessage/page`,
      method: "GET",
      data: params,
    });
  },
  // 点击消息
  clickMessage: async (id) => {
    return await request({
      url: `/app/message/userMessage/getById?id=${id}`,
      method: "GET",
    });
  },
  // 商务合作
  conditionMessage: async (id) => {
    console.log("id", id);
    return await request({
      url: `/app/common/type/condition/${id}`,
      method: "GET",
    });
  },
  // 获取反馈类型列表
  getOpinionType: async (data) => {
    return await request({
      url: `/app/feedback/category/getList`,
      method: "GET",
      data: data,
    });
  },
  // 图片上传
  imgUpload: async (data) => {
    return await requestImg({
      url: `/app/oss/upload`,
      method: "POST",
      data: data,
    });
  },
  // 创建意见反馈
  createOpinion: async (data) => {
    return await request({
      url: `/app/feedback/save`,
      method: "POST",
      data: data,
    });
  },
};

export default myApi;
